using System;
using ScenarioFramework.Modules.FormHelper;
using ScenarioFramework.Portal;

namespace SFPortal
{
	public class Redirect
	{
		static string sHomePage = "~/SF/Forms/Home.aspx";

		public static string Go(string sUrl)
		{
			return sUrl;
		}

		public static string GoError()
		{
			return "~/Error.aspx"; 
		}

		public static string GoError(string sMessage)
		{
			return Redirect.GoError() + "?Dialog=" + ScenarioFramework.Portal.Message.DialogType.Error  + "&ErrMsg='" + sMessage+ "'";
		}
        public static string GoMessage(string sMessage)
        {
            String sUrl = String.Format ("~/Message.aspx?Dialog={0}&ErrMsg='{1}'",ScenarioFramework.Portal.Message.DialogType.Message, sMessage);
            return sUrl;
        }

		public static string GoDefaultPage()
		{
			return "~/Default.aspx"; 
		}

		public static string GoHomePage(string sOwner)
		{
			FormHelper formHelper = Global.FormsHelper.GetFormHelper();
			string sUrl = formHelper.GetHomePage(sOwner);

			if ( sUrl == string.Empty )
			{
				sUrl=sHomePage;
			}

			return sUrl;
		}
	}
}
